package Infinite::Sequence::Factorial;
use base qw{Infinite::Sequence::Function};

sub new {
	my( $class ) = @_;
	$class->SUPER::new( new Infinite::Sequence::Natural, sub {
		my( $n ) = @_;
		return 1 unless $n;
		my $product = 1;
		$product *= $_ for ( 1 .. $n );
		$product
	} )
}

1